package com.example.bootuserservice.controller;

import org.example.pojo.User;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;

@Controller
@RequestMapping("user")
public class UserServiceController {
    @Autowired
    UserService userService;

    @GetMapping("getUserByUserId")
    @ResponseBody
    User getUserByUserId(@RequestParam("userId") Integer userId){
        return userService.getUserById(userId);
    }

    @GetMapping("getAccountByUserId")
    @ResponseBody
    BigDecimal getAccountByUserId(@RequestParam("userId") Integer userId){
        return userService.getAccountByUserId(userId);
    }
}
